package com.shanzmoo.admin.util;

import com.shanzmoo.base.constant.RedisConstant;
import com.shanzmoo.core.constant.RedisCoreKeyPrefix;
import com.shanzmoo.core.util.RedisCoreKeyUtils;

/**
 * 管理后台 redis key 工具类
 *
 * @author： Gzhao 2021/2/10
 */
public class RedisAdminKeyUtils extends RedisCoreKeyUtils {

    /**
     * 基础目录
     */
    private static final String REDIS_ADMIN_ROOT = RedisConstant.REDIS_BAST_ROOT + ":admin:";

    private RedisAdminKeyUtils(){}

    public static String installKey(String... strs) {
        StringBuilder stb = new StringBuilder(REDIS_ADMIN_ROOT);
        for (String s : strs) {
            stb.append(s);
        }
        return stb.toString();
    }

    /**
     * 组装地址树 key
     *
     * @author Gzhao 2021/2/10
     * @return
     */
    public static String installAddressTreeKey() {
        return installKey(RedisKeyPrefix.ADDRESS_TREE);
    }


    /**
     * redis key 前缀
     *
     * @author： Gzhao 2021/2/10
     */
    private static class RedisKeyPrefix{

        /**
         * 地址树
         */
        public static final String ADDRESS_TREE = "address_tree";
    }
}
